import org.apache.spark.SparkConf
import org.apache.spark.sql.SparkSession


object SparkStarocksDemo {
  def main(args: Array[String]): Unit = {
    val sparkConf = new SparkConf().setMaster("local")


    val spark = SparkSession.builder
      .config(sparkConf)
      .appName("Simple Application")
      .getOrCreate()

    val starrocksSparkDF = spark.read.format("starrocks")
      .option("starrocks.table.identifier", s"mydoris.table1")
      .option("starrocks.fe.http.url", s"192.169.43.128:8030")
      .option("starrocks.fe.jdbc.url", s"jdbc:mysql://192.169.43.128:9030")
      .option("starrocks.user", s"root")
      .option("starrocks.password", s"123456")
      .load()

    starrocksSparkDF.show(10)
    spark.stop()
  }
}
